package com.cysoft.log.demo.event.controller;

import com.alibaba.fastjson.JSON;
import com.cysoft.log.demo.event.model.EventGetParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author 玖零
 * @version V0.0.1
 * @project demo-cysoft-starter-log
 * @package com.cysoft.log.demo.event.controller
 * @date 2025-02-27 15:55
 * @desc
 */
@Slf4j
@RestController
@RequestMapping(value = "/event")
public class EventDemoController {

    /**
     * event get 请求 无参数
     * @return
     */
    @GetMapping(value = "/eventGetNoParam")
    public String eventGetNoParam(){
        return "eventGetNoParam success";
    }

    /**
     * event get 请求 有参数
     * @param eventGetParam
     * @return
     */
    @GetMapping(value = "/eventGetHasParam")
    public String eventGetHasParam(EventGetParam eventGetParam){
        log.info("eventGetParam:{}", JSON.toJSONString(eventGetParam));
        return "eventGetHasParam success";
    }

    /**
     * event post请求
     * @param eventGetParam
     * @return
     */
    @PostMapping(value = "/eventPost")
    public String eventPost(@RequestBody EventGetParam eventGetParam){
        log.info("eventPost:{}", JSON.toJSONString(eventGetParam));
        return "eventPost success";
    }


    /**
     * event delete 请求
     * @param id
     * @return
     */
    @DeleteMapping(value = "/eventDelete/{id}")
    public String eventDelete(@PathVariable("id") String id){
        log.info("eventDelete:{}", id);
        return "eventDelete success";
    }
}
